package org.learn.intermediate.homework;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class HomeWork13 {
    public static void main(String[] args) {
        Map m = new HashMap();
        m.put("jack" ,650);
        m.put("tom" ,1200);
        m.put("smith" ,2900);
        System.out.println(m);
        //
        m.put("jack",2600);
        //for
        Set keySet = m.keySet();
        for (Object key :keySet) {
            //更新
            m.put(key,(Integer)m.get(key) + 100);
        }
        System.out.println(m);
        //遍历
        Set entrySet = m.entrySet();
        //迭代器
        Iterator iterator = entrySet.iterator();
        while (iterator.hasNext()) {
            Object next =  iterator.next();
            System.out.println(next);
        }
    }
}
